package com.lovo.user.mq;

import com.lovo.common.util.MQUtil;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class TopicReceiver {
    @Autowired
    private MQUtil mqUtil;
    @RabbitListener(queues = "shop.topic.queue.a")
    public void receiveA(String content, Message message, Channel channel){
        System.out.println("接收消息A：" + content);
        mqUtil.ack(message,channel);
    }
    @RabbitListener(queues = "shop.topic.queue.b")
    public void receiveB(String content, Message message, Channel channel){
        System.out.println("接收消息B：" + content);
        mqUtil.ack(message,channel);
    }
    @RabbitListener(queues = "shop.topic.queue.c")
    public void receiveC(String content, Message message, Channel channel){
        System.out.println("接收消息C：" + content);
        mqUtil.ack(message,channel);
    }
}
